package allrobots.DispensingMachine;

import allrobots.Robot.RobotsOosAndOis;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;

public class DMAndRobotSocket {
    public final static Map<String, DMAndRobotOosOis> robotsSocketMap = new HashMap<>();
    private final static ReentrantLock lock = new ReentrantLock();

    public static void put(String key, DMAndRobotOosOis value) {
        lock.lock();
        try {
            robotsSocketMap.put(key, value);
        } finally {
            lock.unlock();
        }
    }

    public static void remove(String key) {
        lock.lock();
        try {
            robotsSocketMap.remove(key);
        } finally {
            lock.unlock();
        }
    }
}
